package lanqiao;

import java.util.Scanner;

public class SumMax {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
//        int[] arr = {2, 1, 4, 7, 4, 8, 3, 6, 4, 7};
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        int s = scanner.nextInt();
        int left = 0, right = 0;
        int ret = 0;
        while (left < arr.length) {
            int k = s;
            int sum = 0;
            while (k > 0 && right + 2 < arr.length) {
                sum += arr[right];
                right += 2;
                k--;
            }
            ret = Math.max(ret, sum);
            right = left + 1;
            left++;
        }
        System.out.println(ret);
    }
}
